package org.cuatrovientos.pene;
import java.util.Random;


/**
 * @author Viktor eta David 
 * @greets To us
 */
public class PasswordGenerator {
	/**
	 * Auto-generator new passwords
	 * @param lenght
	 * @return
	 */
	public String generate (int lenght) {
		String password = "";
		String characters = "abcdefghijklmnopqrstuvwxyz0123456789";
		Random random = new Random();
		int charactersLengh = characters.length();
		
		if (lenght < 8 || lenght > 20) {
			return "Longitud incorrecta";
		}
		
		for (int i=0;i<lenght;i++) {
			password += characters.charAt(random.nextInt(charactersLengh));
		}
		
		return password;
	}
	
	
	
	
	
	
	
}
